<?php

namespace app\common\model;

use think\Model;

class Update extends Model
{
    protected $autoWriteTimestamp = true;
    public function appUpdate()
    {
        $version = request()->param('ver');
        $res = $this->where('status',1)->order('create_time','desc')->limit(1)->find();
        if(!$res) TApiException('暂无更新版本');
        if(version_compare($res['version'],$version,'<=')) TApiException('暂无更新版本');
        return $res;

    }
}
